n=int(input())
nums=list(map(int,input().split()))
nums.sort()
result=10000
for i in range(1,n):
    result=min(result,nums[i]-nums[i-1])
print(result)
